import type { TableColumn, FormField } from '@/components'
import { reactive } from 'vue'

export const fields = reactive<FormField[]>([
  {
    key: 'name',
    label: '昵称',
    tag: 'ElInput'
  }
])

export const columns: TableColumn[] = [
  {
    key: 'name',
    label: '角色名称'
  },
  {
    key: 'description',
    label: '描述'
  },
  {
    key: 'created_at',
    label: '创建日期'
  },
  {
    key: 'actions',
    label: '操作',
    slot: true,
    fixed: 'right'
  }
]

export const dialogFields = ref([
  {
    key: 'name',
    label: '角色名称',
    tag: 'ElInput',
    required: true
  },
  {
    key: 'description',
    label: '角色描述',
    tag: 'ElInput',
    required: false
  },
  {
    label: '菜单',
    key: 'menu_ids',
    tag: 'MTreeSelect',
    required: false,
    attrs: {
      props: {
        value: 'id',
        label: 'name'
      },
      data: [],
      multiple: true,
      showCheckbox: true,
      checkStrictly: true
    }
  },
  {
    key: 'weight',
    label: '排序',
    tag: 'ElInput',
    required: false
  }
])
